package com.coded2.mobileposto.dao;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

import com.coded2.infra.comum.ComumDAO;
import com.coded2.mobileposto.model.Combustivel;

public class CombustivelDAO extends ComumDAO<Combustivel> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5545981433254818156L;

	@Override
	protected List<Predicate> searchConditions(Combustivel obj,
			CriteriaBuilder builder, Root<Combustivel> root) {
		List<Predicate>condicoes = new ArrayList<Predicate>();
		if(Integer.parseInt(obj.getId().toString()) != 0){
			Predicate nome = builder.equal(root.get("noCombustivel"), obj.getNoCombustivel());
			condicoes.add(nome);
		}
		return condicoes;
	}
	
	
	

}
